Skip to content

Compare volume size in bytes when changing to the same disk offering - #14750

Open
bhouse-nexthop wants to merge 1 commit into
apache:4.22from
bhouse-nexthop:volume-offering-resize-size-check
Open

bhouse-nexthop wants to merge 1 commit into
apache:4.22from
bhouse-nexthop:volume-offering-resize-size-check

Conversation

@bhouse-nexthop

Copy link
Copy Markdown
Collaborator

Description

Fixes #14749

checkIfVolumeCanResizeWithNewDiskOffering shifted an already-bytes size by 30 again, so its "already having disk offering" guard never matched for custom-size offerings.

changeOfferingForVolume to the same custom offering before after
same size, same IOPS ran the full change path rejected: "already having disk offering"
same size, new IOPS allowed allowed
new size allowed allowed
compute-only offering (size taken from the volume) allowed allowed
  • Drop the second << 30.
  • Only reject when min/max IOPS are also unchanged.
  • Skip compute-only offerings (scale VM to the same custom service offering goes through here).

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Bug Severity

  • Minor

How Has This Been Tested?

test result
VolumeApiServiceImplTest (150 tests, 5 new) pass
new rejection test against the unfixed code fails as expected

validateVolumeResizeWithNewDiskOfferingAndLoad converts a custom
offering's size from GiB to bytes, then checkIfVolumeCanResizeWithNewDiskOffering
shifted it by 30 again, so its "already having disk offering" guard
never matched for custom-size offerings.

| changeOfferingForVolume to the same custom offering | before | after |
|---|---|---|
| same size, same IOPS | ran the full change path | rejected: "already having disk offering" |
| same size, new IOPS | allowed | allowed |
| new size | allowed | allowed |
| compute-only offering (size taken from the volume) | allowed | allowed |

- Drop the second `<< 30` in the comparison.
- Only reject when min/max IOPS are also unchanged, so IOPS-only
  changes keep working.
- Skip compute-only offerings: their size always equals the volume's,
  and scale VM to the same custom service offering goes through here.
- Add unit tests for each row.

Signed-off-by: Brad House <bhouse@nexthop.ai>
@codecov

codecov Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.32%. Comparing base (b56bbc2) to head (496f21b).

Files with missing lines Patch % Lines
...n/java/com/cloud/storage/VolumeApiServiceImpl.java 60.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.22   #14750   +/-   ##
=========================================
  Coverage     18.32%   18.32%           
- Complexity    16644    16652    +8     
=========================================
  Files          5939     5939           
  Lines        537787   537789    +2     
  Branches      65932    65934    +2     
=========================================
+ Hits          98544    98547    +3     
+ Misses       428033   428012   -21     
- Partials      11210    11230   +20     
Flag Coverage Δ
uitests 4.08% <ø> (ø)
unittests 19.41% <60.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant